package com.lagou.rabbitmq.exception;

import com.lagou.rabbitmq.vo.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class GlobalExceptionHandler {

    private Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class);

    /**
     * 基础异常
     */
    @ResponseBody
    @ExceptionHandler(BaseException.class)
    public R baseException(BaseException ex) {
        return R.error(ex.getDefaultMessage());
    }

}